package com.liancheng.smarthome.bean.module;

import android.databinding.ObservableBoolean;
import android.databinding.ObservableField;
import android.databinding.ObservableInt;

import com.liancheng.smarthome.utils.appcommon.AppCommonUtils;
import com.liancheng.smarthome.utils.common.DateUtil;
import com.liancheng.smarthome.utils.constant.WorkerConstant;

import java.util.ArrayList;
import java.util.List;

/**
 * 设备监控页面数据
 */
public class EquipLookListItemBean {

    public ObservableField<String > equipName = new ObservableField<>();
    public ObservableField<String > networkSeriale = new ObservableField<>();
    public ObservableField<String > projectNum = new ObservableField<>();

    public ObservableInt equipStatus = new ObservableInt();

    public String equipLookId ;

    public EquipLookListItemBean(String equipLookId, String equipNameI
            , String networkSerialeI, String projectNumI, int equipStatusI){
        this.equipName.set(equipNameI);
        this.networkSeriale.set(networkSerialeI);
        this.projectNum.set(projectNumI);
        this.equipStatus.set(equipStatusI);

        this.equipLookId = equipLookId;
    }

    //合并网络数据
//    public static List<EquipLookListItemBean> mergeFromData(List<AlarmListVMBean.ListBean> beans){
//        if(AppCommonUtils.arrayIsEmtry(beans)) return null;
//        List<EquipLookListItemBean> alarmListItemBeans = new ArrayList<>();
//        for (int i = 0; i < beans.size(); i++) {
//            AlarmListVMBean.ListBean listBean = beans.get(i);
//            alarmListItemBeans.add(new EquipLookListItemBean(listBean.getAlarmId(),listBean.getDeviceName(),
//                    listBean.getAlarmMsg(),
//                    DateUtil.getStringForMillis(listBean.getAlarmTime(),DateUtil.DATE_YMDHMS1),
//                    WorkerConstant.getReadTypeByTag(listBean.getStatus())));
//        }
//        return alarmListItemBeans;
//    }

    public static List<EquipLookListItemBean> buildData(){
        List<EquipLookListItemBean> listItemBeans = new ArrayList<>();

        for (int i = 0; i < 20; i++) {
            listItemBeans.add(
                    new EquipLookListItemBean("","设备名称","300217090291"
                    ,"一体化预知泵设备",(i%4+1))
            );
        }
        return listItemBeans;
    }

}
